package four;
import java.util.List;
import java.util.Scanner;

public class Main {

	    public static void main(String[] args) {
	        Student student1 = new Student(100001, "快快");
	        Student student2 = new Student(100002, "乐乐");
	        Lab computerRoom = new Lab("computerRoom001", "计算机网络实验室");
	        Lab compositionRoom = new Lab("compositionRoom001", "组成原理实验室");
	        Money.dePartureRoom(student1, computerRoom);
	        Money.dePartureRoom(student1, compositionRoom);
	        Money.dePartureRoom(student2, computerRoom);
	        
	        int computerExcellentCount = 4;
	        int computerPassCount = Money.weekCount - computerExcellentCount;
	        System.out.println("计算机网络实验室优秀次数:" + computerExcellentCount);
	        System.out.println("计算机网络实验室合格次数:" + computerPassCount);
	        List<Student> computerStudentList = Money.roomStudentMap.get(computerRoom.getId());
	        if (computerStudentList != null) {
	            for (int i = 0; i < computerStudentList.size(); i++) {
	                Student student = (Student) computerStudentList.get(i);
	                student.setExcellentCount(student.getExcellentCount() + computerExcellentCount);
	                student.setPassCount(student.getPassCount() + computerPassCount);
	            }
	        }

	        int compositionExcellentCount = 3;
	        int compositionPassCount = Money.weekCount - compositionExcellentCount;
	        System.out.println("组成原理实验室优秀次数:" + compositionExcellentCount);
	        System.out.println("组成原理实验室合格次数:" + compositionPassCount);

	        List<?> compositionStudentList = Money.roomStudentMap.get(compositionRoom.getId());
	        if (compositionStudentList != null) {
	            for (int i = 0; i < compositionStudentList.size(); i++) {
	                Student student = (Student) compositionStudentList.get(i);
	                student.setExcellentCount(student.getExcellentCount() + compositionExcellentCount);
	                student.setPassCount(student.getPassCount() + compositionPassCount);
	            }
	        }

	        System.out.println("请输入国家最新税率标准:");
	        Scanner scanner = new Scanner(System.in);
	        while (true) {
	            try {
	            	Money.taxRate = Double.parseDouble(scanner.next());
	                break;
	            } catch (Exception e) {
	                System.err.println("税率标准输入格式不正确");
	                System.out.println("请输入国家最新税率标准:");
	            }
	        }
	        Money.calculateAccout(student1);
	        Money.calculateAccout(student2);
	    }

	}